<template>
  <div>
    <el-upload class="avatar-uploader"
               action="https://httpbin.org/post"
               :on-success="handleAvatarSuccess"
               :on-remove='handleRemove'
               list-type="picture-card">
      <img v-if="imageUrl"
           :src="imageUrl"
           class="avatar">
      <i v-else
         class="el-icon-plus avatar-uploader-icon"></i>
    </el-upload>
  </div>
</template>

<script>
export default {
  name: 'Upload',
  methods: {
    handleAvatarSuccess (res) {

      this.$emit('input', res.files.file)
    },
    handleRemove (file) {

      this.$emit('input', '')
    },
    request (res) {
      let file = res.file;
      let formData = new FormData()
      formData.append("file", file);


      //   this.$http.post('https://httpbin.org/post',{
      //       file:res

      //   }).then(res=>{

      //   })
    }
  }
}
</script>

<style>
</style>
